package com.qtyx.nms.ui.adapter

import android.content.Context
import android.graphics.Color
import android.widget.TextView
import com.ldd.base.ui.adapter.BaseRVAdapter
import com.ldd.base.ui.adapter.BaseRVVH
import com.qtyx.nms.R
import com.qtyx.nms.mvp.model.bean.NurseBean

/**
 * 护理子适配器
 */
class NurseChildAdapter(mContext: Context, list: List<NurseBean.Data.SqlData>, private val contentColor:String) :BaseRVAdapter<NurseBean.Data.SqlData>(mContext, list) {

    override fun getLayoutId(viewType: Int)= R.layout.item_nurse_child


    override fun convert(vh: BaseRVVH, position: Int, data: NurseBean.Data.SqlData) {
        val tvContent=vh.getView<TextView>(R.id.tv_item_nurse_child_content)

        tvContent.text=data.BED_NO
        if(contentColor.isNotEmpty()){
            tvContent.setTextColor(Color.parseColor(contentColor))
        }
        tvContent.setOnClickListener {
            onItemClickListener?.onItemClick(position)
        }
    }

    var onItemClickListener: OnItemClickListener? = null

    interface OnItemClickListener {
        fun onItemClick(position: Int)
    }

}